{extend name="common/base" /}


{block name="body"}
<div class="Hui-admin-article">


    <article class="Hui-admin-content clearfix">

        <div class="panel mt-20">

            <div class="panel-body">
                <div class="clearfix">
                    <span class="f-l">

                        <a href="javascript:;" onclick="article_type_add('添加视频')" class="btn btn-primary radius"><i class="Hui-iconfont">&#xe600;</i> 添加视频</a>
                    </span>
                    <span class="f-r">共有数据：<strong>{$count}</strong> 条</span>
                </div>
                <div class="mt-20 clearfix">
                    <table class="table table-border table-bordered table-bg table-hover table-sort">
                        <thead>
                        <tr>
                            <th scope="col" colspan="6">课程章节列表</th>
                        </tr>
                        <tr class="text-c">
                            <th width="25"><input type="checkbox" name="all" value=""></th>
                            <th width="40">ID</th>
                            <th width="40">排序(章节)</th>
                            <th width="150">章节名称</th>
                            <th width="150">讲师</th>
                            <th width="100">视频地址</th>
                            <th width="60">播放时长</th>
                            <th width="100">操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        {foreach name="list" key="k" item="v"}
                        <tr class="text-c">
                            <td><input name="list_box" type="checkbox" value="{$v.id}" ></td>
                            <td>{$k+1}</td>
                            <td>{$v.sort}</td>
                            <td>{$v.title}</td>
                            <td>{$v.teacher_name}</td>
                            <td>{$v.play_url}</td>
                            <td>{$v.time}</td>
                            <td class="td-manage">
                                <a title="编辑" href="javascript:;" onclick="article_type_edit('分类编辑',{$v.id},'900','600')" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6df;</i></a>
                                <a title="删除" href="javascript:;" onclick="kc_del(this,{$v.id})" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6e2;</i></a>
                            </td>
                        </tr>
                        {/foreach}

                        </tbody>
                    </table>

                    {$page}
                </div>
            </div>
        </div>
    </article>
</div>

<input name="del" type="hidden" value="{:url('web/del_video')}">
<input name="edit" type="hidden" value="{:url('web/edit_video')}">
<input name="add" type="hidden" value="{:url('web/add_video')}">

{/block}


{block name="js"}
<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="__LIB__/datatables/1.10.15/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="__LIB__/laypage/1.2/laypage.js"></script>
<script type="text/javascript" src="__JS__/main.js"></script>
<script type="text/javascript">
    $(function(){
        runDatetimePicker();
    });

    $("select[name='link_type']").bind('change',function(){
        var val = $(this).val();
        if(val == 3){
            $("input[name='link']").show();
        }else{
            $("input[name='link']").hide();
        }
    });

    /*资讯分类-删除*/
    function kc_del(obj,id){
        layer.confirm('确认要删除吗？',function(index){
            var url = $("input[name='del']").val();
            console.log(id);
            $.ajax({
                type: 'POST',
                url: url,
                data:{id:id},
                dataType: 'json',
                success: function(data){
                    $(obj).parents("tr").remove();
                    layer.msg('已删除!',{icon:1,time:1000});
                },
                error:function(data) {
                    console.log(data.msg);
                },
            });
        });
    }
</script>
<!--/请在上方写此页面业务相关的脚本-->
{/block}

